package org.apache.lucene.index;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;

public class TagFieldInfos implements Serializable {
  private Map<String,Integer> fieldMap;
  private Map<Integer,String> numMap;
  
  public TagFieldInfos(Map<String,Integer> fieldMap) {
    this.fieldMap = fieldMap;
    
  }
  
  public List<String> fieldNames() {
    return new ArrayList<String>(fieldMap.keySet());
  }
  
  void add(String name, int num) {
    fieldMap.put(name, num);
    numMap.put(num, name);
  }
  
  public int getMaxNum() {
    return Collections.max(numMap.keySet());
  }
  
  public int fieldNumber(String name) {
    return fieldMap.get(name);
  }
  
  public String fieldName(int num) {
    return numMap.get(num);
  }
}
